﻿@{    
    //page title
    ViewBag.Title = T("Admin.Configuration.Tax.Providers").Text;
}


<div class="row">
    <div class="col-md-12">
        <div class="x_panel light form-fit">
            <div class="x_title">
                <div class="caption level-caption">
                    <i class="fa fa-money"></i>
                    @T("Admin.Configuration.Tax.Providers")
                </div>
                <vc:admin-widget widget-zone="tax_provider_list_buttons" additional-data="null" />
            </div>
            <div class="x_content form">
                <div class="form-horizontal">
                    <div class="form-body">
                        <div class="x_content">
                            <div id="tax-providers-grid"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
$(document).ready(function () {
    $("#tax-providers-grid").kendoGrid({
        dataSource: {
            transport: {
                read: {
                    url: "@Html.Raw(Url.Action("Providers", "Tax"))",
                    type: "POST",
                    dataType: "json",
                    data: addAntiForgeryToken
                }
            },
            schema: {
                data: "Data",
                total: "Total",
                errors: "Errors"
            },
            error: function (e) {
                display_kendoui_grid_error(e);
                // Cancel the changes
                this.cancelChanges();
            },
            serverPaging: true,
            serverFiltering: true,
            serverSorting: true
        },
        pageable: {
            refresh: true,
            numeric: false,
            previousNext: false,
            info: false
        },
        editable: {
            confirmation: false,
            mode: "inline"
        },
        scrollable: false,
        columns: [{
            field: "FriendlyName",
            title: "@T("Admin.Configuration.Tax.Providers.Fields.FriendlyName")",
            width: 250,
            template: '<a class="k-link" href="#=ConfigurationUrl#">#=FriendlyName#</a>',
        }, {
            field: "SystemName",
            title: "@T("Admin.Configuration.Tax.Providers.Fields.SystemName")",
            width: 250,
            template: '<a class="k-link" href="#=ConfigurationUrl#">#=SystemName#</a>',
        }, {
            field: "IsPrimaryTaxProvider",
            title: "@T("Admin.Configuration.Tax.Providers.Fields.IsPrimaryTaxProvider")",
            width: 100,
            headerAttributes: { style: "text-align:center" },
            attributes: { style: "text-align:center" },
            template: '# if(IsPrimaryTaxProvider) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
        }, {
            field: "SystemName",
            title: "@T("Admin.Configuration.Tax.Providers.Fields.MarkAsPrimaryProvider")",
            width: 200,
            template: '<a href="@Url.Content("~/Admin/Tax/MarkAsPrimaryProvider/")?systemName=#=SystemName#" class="k-button">@T("Admin.Configuration.Tax.Providers.Fields.MarkAsPrimaryProvider")</a>'
        }]
    });
});
</script>
